package org.ivwsqii.delegate;

import java.util.HashMap;
import java.util.Map;

/**
 * 代理(委派)角色, 是整个模式的核心角色,判断应该实例化哪个具体实现类
 * 即，决定给A B C三个职工分配什么样的的任务
 * @author Administrator
 *
 */
public class Leader implements ITarget {

	private Map<String, ITarget> targets = new HashMap<>();

	public Leader() {
		targets.put("ivws", new TargetA());
		targets.put("qii", new TargetB());
		targets.put("dx", new TargetC());
	}

	@Override
	public void doSomething(String command) {
		targets.get(command).doSomething(command);
	}

}
